﻿extends layout

block content
	script(src='/socket.io/socket.io.js')
	script
		$(document).ready(function(){
			var socket = io.connect();
			socket.emit('join',["#{name}"]);
			socket.on('message', function(data){
				var output='<li><h3>'+data.sender+'</h3> : <p>'+data.textdata+'</p></li>';
				$(output).prependTo('#chatcontent');
			});
			$('#send').click(function(){
				socket.emit('message',{sender:'#{username}',textdata: $('#typechat').val()});
			});
		});
		
	p Welcome to #{name} , #{username} 님
	div(style="position:absolute;top:0;left:0;width:800;height:20;background-color:#ffffff")
		input#typechat(type='text')
		input#send(type='submit', value='전송')
	div(style="position:absolute;top:20;left:0;width:800;height:200;background-color:#777777;overflow:scroll")
		ul#chatcontent